from django.urls import path, include, re_path
from chart_web.views import account, kaidan, blue_sky, poet, crab_love,search
from django.views.static import serve
from django.conf import settings

urlpatterns = [
    # 图像接口开放
    re_path('media/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}),
    # 注册登录
    re_path('^register_login.html/$', account.register_login, name='register_login'),
    # 发送短信
    re_path('^tencent/sms/$', account.tencent_sms, name='tencent_sms'),
    # 退出登录
    re_path('^logout.html/$', account.logout, name='logout'),
    # 个人中心
    re_path('^personal/center.html/$', account.personal_center, name='personal_center'),
    # 修改手机号
    re_path('^modify/telephone/(?P<user_id>\d+)/$', account.modify_telephone, name='modify_telephone'),
    # 修改密码
    re_path('^modify/password/(?P<user_id>\d+)/$', account.modify_password, name='modify_password'),
    # 修改用户名
    re_path('^modify/username/(?P<user_id>\d+)/$', account.modify_username, name='modify_username'),
    # 修改头像
    re_path('^modify/icon/(?P<user_id>\d+)/$', account.modify_icon, name='modify_icon'),

    # 怪谈餐馆预览页面(文章渲染)
    re_path('^kaidan/restaurant/$', kaidan.kaidan_restaurant, name='kaidan_restaurant'),
    # 怪谈餐馆文章添加
    re_path('^kaidan/(?P<username>\w+)/article_add/$', kaidan.article_add, name='article_add'),
    # 怪谈餐馆文章详细页面
    re_path('^kaidan/(?P<pk>\d+)/article/$', kaidan.kaidan_article, name='kaidan_article'),
    # 怪谈点赞
    re_path('^kaidan/(?P<pk>\d+)/StepUp/$', kaidan.Step_up, name='Step_up'),
    # 怪谈点踩
    re_path('^kaidan/(?P<pk>\d+)/StepDown/$', kaidan.Step_down, name='Step_down'),
    # 怪谈评论
    re_path('^kaidan/(?P<pk>\d+)/kaidan_comment/$', kaidan.kaidan_comment, name='kaidan_comment'),
    # 怪谈评论点赞
    re_path('^kaidan/(?P<comment_id>\d+)/kaidan_comment_up/$', kaidan.kaidan_comment_up,
            name='kaidan_comment_up'),
    # 怪谈评论点踩
    re_path('^kaidan/(?P<comment_id>\d+)/kaidan_comment_down/$', kaidan.kaidan_comment_down,
            name='kaidan_comment_down'),

    # 螃蟹预览页面(文章渲染) crab
    re_path('^crab/love/$', crab_love.crab_love, name='crab_love'),
    # 怪谈餐馆文章添加
    re_path('^crab/(?P<username>\w+)/crab_love_add/$', crab_love.crab_love_add, name='crab_love_add'),
    # 怪谈餐馆文章详细页面
    re_path('^crab/(?P<pk>\d+)/article/$', crab_love.crab_article, name='crab_article'),

    # 无障碍聊天室 blue/sky
    re_path('^blue/sky/$', blue_sky.blue_sky, name='blue_sky'),
    # 有密码保护的聊天室 poet
    re_path('^poet/(?P<group>\d+)/$', poet.poet, name='poet'),
    # 过渡 transition
    re_path('^transition/(?P<username>\w+)/$', poet.transition, name='transition'),

    # 文章搜索
    re_path('^search/$', search.search_article, name='search_article'),
    # 主页
    re_path('^', account.home, name='home'),

]
